#include <stdio.h> 
#include <sys/socket.h> 
#include <string.h> 
#include <arpa/inet.h> 
#include <unistd.h> 

int main(int argc, char **argv) {
    int fd = socket(AF_INET, SOCK_STREAM, 0);
    if (fd < 0) {
        perror("socket error");
    }

    struct sockaddr_in server_addr;
    memset(&server_addr, 0, sizeof(struct sockaddr_in));

    server_addr.sin_port = htons(7777);
    server_addr.sin_family = AF_INET;
    if (inet_pton(AF_INET, "127.0.0.1", &server_addr.sin_addr) < 0) {
        perror("inet_pton error");
        return -1;
    }

    if (connect(fd, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) {
        perror("connect error");
        return -1;
    }
    int ret = write(fd, "hello", 6);
    printf("xxxx\n");
    while(1) {
        sleep(1);
    };

    return 0;
}
